package com.kould.enity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.github.houbb.data.factory.api.annotation.DataFactory;
import com.google.gson.annotations.JsonAdapter;
import com.kould.api.KacheEntity;
import com.kould.common.adapter.IdAdapter;
import com.kould.common.base.BasePO;
import com.kould.enumeration.ArticleType;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName("kork_article")
public class Article extends BasePO implements KacheEntity {

    private static final long serialVersionUID = -4470366380115322213L;

    @DataFactory(minLen = 10)
    private String title;

    private String summary;

    @JsonAdapter(IdAdapter.class)
    private Long authorId;

    @JsonAdapter(IdAdapter.class)
    private Long bodyId;

    @JsonAdapter(IdAdapter.class)
    private Long categoryId;

    private Integer commentCounts;

    private Long viewCounts;

    private ArticleType weight;

    @Override
    public String getPrimaryKey() {
        return getId().toString();
    }
}
